package com.hyzh.latte.vehicle.dmo;

import com.hyzh.latte.util.gather.Point;
import com.hyzh.latte.vehicle.dmo.entity.PersonTrackRecordPGEntity;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 和算法 对接
 * 人员轨迹数据 需要商定
 * @author songkui
 * @since 2024/3/20 14:05
 */
@Getter
@Setter
@NoArgsConstructor
@ToString
@AllArgsConstructor
@EqualsAndHashCode(of ={"oid"})
public class PersonTrackDTO implements Serializable {

    private String cno;  //摄像头 编号
    private String oid;  //人员ID;
    private String lon;   // 经度度
    private String lat;   // 维度


    public PersonTrackDTO(double lat, double lon){
        this.lon = String.valueOf(lon);
        this.lat = String.valueOf(lat);
    }

    public PersonTrackRecordPGEntity buildEntity(String parkCode, LocalDateTime addTime){
        PersonTrackRecordPGEntity entity = new PersonTrackRecordPGEntity();
        entity.setParkCode(parkCode);
        entity.setAddTime(addTime);
        entity.setCameraCode(this.cno);
        entity.setOid(this.oid);
        entity.setLon(this.lon);
        entity.setLat(this.lat);
        return entity;
    }

    public Point buildPoint(){
        return new Point(new Double(this.lat) , new Double(this.lon));
    }

}
